package ph.com.gs3.formalistics.global.dummies;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONException;
import org.json.JSONObject;

import ph.com.gs3.formalistics.model.vo.view.ViewColumn;
import ph.com.gs3.formalistics.presenter.adapters.KeyValueGroupListViewAdapter;

public class DummyEmbeddedViewData {

	public static KeyValueGroupListViewAdapter fillAdapter(KeyValueGroupListViewAdapter adapter) {

		List<JSONObject> listData = new ArrayList<>();
		List<ViewColumn> viewColumns = new ArrayList<>();

		viewColumns.add(new ViewColumn("_id", "Id"));
		viewColumns.add(new ViewColumn("first_name", "First Name"));
		viewColumns.add(new ViewColumn("last_name", "Last Name"));

		try {
			for (int i = 1; i <= 50; i++) {
				JSONObject objectItem = new JSONObject();
				objectItem.put("_id", i);
				objectItem.put("first_name", "First Name " + i);
				objectItem.put("last_name", "Last Name " + i);

				listData.add(objectItem);
			}

			adapter.setData(viewColumns, listData);
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return adapter;

	}

}
